package zl.jfreechart;

import java.awt.Font;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.ui.RefineryUtilities;

public class FirstJFreeChart {
	
	public FirstJFreeChart(){}
	
	public static void main(String[] args){
		DefaultPieDataset dpd = new DefaultPieDataset();
		dpd.setValue("管理人员", 25);
		dpd.setValue("市场人员", 25);
		dpd.setValue("开发人员", 45);
		dpd.setValue("其他人员", 5);
		//乱码解决方案
		//创建主题样式  
		StandardChartTheme standardChartTheme=new StandardChartTheme("CN"); 
		//设置标题字体  
		standardChartTheme.setExtraLargeFont(new Font("隶书",Font.BOLD,20)); 
		//设置图例的字体  
		standardChartTheme.setRegularFont(new Font("宋书",Font.PLAIN,15)); 
		//设置轴向的字体  
		standardChartTheme.setLargeFont(new Font("宋书",Font.PLAIN,15)); 
		//应用主题样式  
		ChartFactory.setChartTheme(standardChartTheme); 
		JFreeChart pieChart = ChartFactory.createPieChart("CityInfoPort公司组织架构图", dpd, true, true, false);
		ChartFrame pieFrame = new ChartFrame("CityInfoPort", pieChart);
		pieFrame.pack();
		RefineryUtilities.centerFrameOnScreen(pieFrame);
		pieFrame.setVisible(true);
	}
}
